import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
from home import Ui_ChatterBot

class MainWin(QMainWindow,Ui_ChatterBot):
    def __init__(self):
        super(MainWin, self).__init__()
        self.setupUi(self)
        self.setFixedSize(440, 700)
        self.actionAbout.triggered.connect(self.actionAbout_clicked)
        self.action.triggered.connect(QtCore.QCoreApplication.quit)
        self.pushButton.clicked.connect(self.send_msg)

    def actionAbout_clicked(self):
        QtWidgets.QMessageBox.about(self, "About", "Chatterbot by 人工智能小组")

    def send_msg(self):
        txt = self.textEdit.toPlainText()
        if txt == '':
            QtWidgets.QMessageBox.warning(self,"Warning","消息为空！")
        else:
            self.textBrowser.append(txt)
            self.textEdit.setText('')

if __name__ == '__main__':
    app = QApplication(sys.argv)
    myw = MainWin()
    myw.show()
    sys.exit(app.exec())
